\documentclass[a4paper,fleqn]{book}

\usepackage{graphicx,amsfonts,psfrag,fancyhdr,layout,appendix,subfigure}
\usepackage[sectionbib]{natbib}
\usepackage{chapterbib}
\usepackage{listings}
\usepackage[pdftex,pdfstartview=FitH,bookmarks=true]{hyperref}

%hyperef options
\hypersetup{
  bookmarksopen=false,
  pdffitwindow=true,
  pdfborder={0 0 0},
  colorlinks={false, true},
  linkcolor=blue,
  citecolor=green,
  filecolor=blue,
  urlcolor=blue}

% Set equal margins on book style
\setlength{\oddsidemargin}{33pt}   % was: 53pt
\setlength{\evensidemargin}{33pt}  % was: 53pt
\setlength{\marginparwidth}{42pt}  % was: 57pt
\setlength{\footskip}{15pt}        % was: 30pt

% Redefine plain page style
\fancypagestyle{plain}{
  \fancyhf{}
  \renewcommand{\headrulewidth}{0pt}
  \fancyfoot[LE,RO]{\thepage}
}

% Code for creating empty pages
% No headers on empty pages before new chapter
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  \hbox{}
  \thispagestyle{plain}
  \newpage
  \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother \clearpage{\pagestyle{plain}\cleardoublepage}

% Define pagestyle
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{ \emph{#1}}{}}
\fancyhead[LO]{}
\fancyhead[RE]{\leftmark}
\fancyfoot[LE,RO]{\thepage}

% Dutch style of paragraph formatting, i.e. no indents.
\setlength{\parskip}{1.3ex plus 0.2ex minus 0.2ex}
\setlength{\parindent}{0pt}

% Less detailed TOC
\setcounter{tocdepth}{1}
